import message from '@/router/console/message'
import type { RouteRecordRaw } from 'vue-router'
import user from "@/router/console/user";
import order from "@/router/console/order";
import releaseSetting from "@/router/console/releaseSetting";
import system from "@/router/console/system";
import tenant from "@/router/console/tenant";
import product from "@/router/console/product";
import productApply from "@/router/console/productApply";
import complaint from "@/router/console/complaint";

const isDev = import.meta.env.MODE === 'development'

export default [
  {
    path: '/',
    redirect: localStorage.getItem('token') ? '/console' : '/login',
  },
  ...(isDev ? [
    {
      path: '/c',
      component: () => import('@/views/localComponentList.vue'),
      meta: {
        title: '组件列表'
      }
    }
  ] : []),
  {
    path: '/login',
    component: () => import('@/views/loginView.vue'),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/console',
    redirect: '/console/user',
    component: () => import('@/views/console/IndexLayout.vue'),
    meta: {
      title: '管理后台'
    },
    children: [
      user,
      product,
      productApply,
      complaint,
      order,
      releaseSetting,
      message,
      tenant,
      system
    ]
  },
  {
    path: '/:path(.*)*',
    name: '404',
    component: () => import('@/views/notFount.vue')
  }
] as RouteRecordRaw[]
